import json
import copy
import os
from typing import List
from typing import Union
from apis import api_routes
from sqlalchemy import desc
from sqlalchemy import and_
from flask import Response
from flask import abort, g, request, jsonify
from models.users.roles import Roles as Rs
from models.users.users import Users as Us
from public.path import get_project_path
from security.decoration import certification
from public.sidebar import sidebars
from public.contexts import context_logs
from models.course.course import Course


@api_routes.route(rule="/software", methods=["POST"])
def func_software_get_api():

    # http://127.0.0.1:8080/api/software

    file: Union[request.files, None] = request.files.get("file")
    r_path = get_project_path() + os.sep + "upload"
    if not os.path.exists(r_path):
        os.makedirs(r_path)
    if file is not None:
        file.save(r_path + os.sep + file.filename)

    return jsonify({"status": 200, "message": "上传成功"})



